package cq.zhcqk.fragment._4_sq;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.loopj.android.http.AsyncHttpClient;

import cq.zhcqk.R;
import cq.zhcqk.activity.LoginActivity;
import cq.zhcqk.activity.SQ_WjdcActivity;
import cq.zhcqk.activity.SQ_YjjyActivity;
import cq.zhcqk.activity.ZW_ListActivity;
import cq.zhcqk.util.AsyncHttpClientUtils;

/**
 * Created by zhangle on 2017/12/3.
 */
public class _2_SqmyFragment extends Fragment implements View.OnClickListener{
    private View view;
    private Context context;
    private AsyncHttpClient httpClient;
    private TextView dcwj;
    private TextView yjjy;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        if(view==null){
            view = inflater.inflate(R.layout.fragment_sqmy_4_2, container, false);
            httpClient = AsyncHttpClientUtils.getInstance().getAsyncHttpClient();
            context = getActivity();
            initView();
        }
        ViewGroup parent=(ViewGroup)view.getParent();
        if(parent!=null){
            parent.removeView(view);
        }
        return view;
    }

    private void initView(){
        dcwj = (TextView) view.findViewById(R.id.dcwj);
        yjjy = (TextView) view.findViewById(R.id.yjjy);

        dcwj.setOnClickListener(this);
        yjjy.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent intent = null;
        switch (v.getId()){
            case R.id.dcwj:
                startActivity(new Intent(context,SQ_WjdcActivity.class));
//                intent = new Intent(context,ZW_ListActivity.class);
//                intent.putExtra("type","26");
//                startActivity(intent);
                getActivity().overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
                break;
            case R.id.yjjy:
                startActivity(new Intent(context,SQ_YjjyActivity.class));
//                intent = new Intent(context,ZW_ListActivity.class);
//                intent.putExtra("type","25");
//                startActivity(intent);
                getActivity().overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
                break;
        }
    }
}
